package net.xiangcaowuyu.springcloud.alibaba.seata.service.impl;

import io.seata.core.context.RootContext;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.extern.slf4j.Slf4j;
import net.xiangcaowuyu.springcloud.alibaba.seata.dao.StorageDao;
import net.xiangcaowuyu.springcloud.alibaba.seata.service.IStorageService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * 博客：https://www.xiangcaowuyu.net
 * Description:
 *
 * @Author: 香草物语
 * DateTime: 2021-07-25 21:12
 */
@Service
@Slf4j
public class StorageServiceImpl implements IStorageService {

    @Resource
    private StorageDao storageDao;

    @Override
//    @Transactional
    public int decrease(Long productId, Integer count) {
        log.info("--------->storage-------decrease获取xid：" + RootContext.getXID());
        return storageDao.decrease(productId, count);
    }
}
